<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// 应用公共文件

function getJson($code, $message, $data = [])
{
    $data = [
        'code' => $code,
        'message' => $message,
        'data' => $data,
    ];
    return json($data);
}

function doAudit($str)
{
    $keyword = array ('1', '2', '3', '4' );	//定义敏感词
    $m = 0;
    for($i = 0; $i < count ( $keyword ); $i ++) {	//根据数组元素数量执行for循环
        //应用substr_count检测文章的标题和内容中是否包含敏感词
        if (substr_count ( $str, $keyword [$i] ) > 0) {
            $m ++;
        }
    }
    return '包含敏感词';
}